//
//  CYCreditTool.h
//  CreditAddressBook
//
//  Created by Lee on 15/5/7.
//  Copyright (c) 2015年 Lee. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CYHttpTool.h"
@class CYDefaultRecord;
@class CYDefaultRecordPics;
@class CYNetworkCollectRecord;
@class LEProgressButton;

/**
 *  yyyy年MM月dd日
 */
static NSString *const CYDefaultTimeFormatType = @"yyyy年MM月dd日";
/**yyyy年MM月dd日 HH:mm:ss*/
static NSString *const CYTimeFormatYMDHmSType = @"yyyy年MM月dd日 HH:mm:ss";
/**yyyy-MM-dd HH:mm*/
static NSString *const CYTimeFormatYMDHmsType = @"yyyy-MM-dd HH:mm";
/**HH:mm*/
static NSString *const CYTimeFormatHmType = @"HH:mm";
/**yyyyMMdd*/
static NSString *const CYTimeFormatYMDType = @"yyyyMMdd";
/**yyyy*/
static NSString *const CYTimeFormatYType = @"yyyy";

@interface CYCreditTool : NSObject

/**
 *  获取最新的黑名单数据
 *
 *  @param params  参数
 *  @param success
 *  @param failure
 */
+ (void)newsDefaultsWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  根据身份证号、姓名、号码等进行查询
 *
 *  @param params  身份证号、姓名、号码等
 *  @param success
 *  @param failure
 */
+ (void)defaultRecordsBySearchWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  获取总记录数
 *
 *  @param success
 *  @param failure
 */
+ (void)totalCountForsuccess:(void (^)(NSNumber *total))success failure:(HttpRequestFailure)failure;

/**
 *  还款展示
 *
 *  @param params
 *  @param success 
 *  @param failure
 */
+ (void)payBacksWithParams:(NSDictionary *)params success:(void (^)(NSArray *payBacks))success failure:(HttpRequestFailure)failure;

/**
 *  图片上传
 */
+ (void)uploadPicImage:(UIImage *)image success:(void (^)(NSString *imageUrl))success failure:(HttpRequestFailure)failure uploadProgress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block;
/**
 *  图片上传1
 */
+ (void)uploadUserImage:(UIImage *)image button:(LEProgressButton *)btn success:(void (^)(NSString *imagePath))success failure:(HttpRequestFailure1)failure;

/**
 *  违约发布
 */
+ (void)saveDefaultRecordWithParams:(NSDictionary *)params success:(void (^)(NSString *message))success failure:(HttpRequestFailure)failure;

/**
 *  违约编辑
 */
+ (void)editDefaultRecordWithParams:(NSDictionary *)params success:(void (^)(CYDefaultRecord *defr))success failure:(HttpRequestFailure)failure;

/**
 *  违约删除
 */
+ (void)deleteDefaultRecordWithParams:(NSDictionary *)params success:(void (^)(NSString *message))success failure:(HttpRequestFailure)failure;

/**
 *  提交违约记录到审核
 */
+ (void)submitDefaultRecordWithParams:(NSDictionary *)params success:(void (^)(NSString *message))success failure:(HttpRequestFailure)failure;

/**
 *  撤销违约记录
 */
+ (void)cancelDefaultRecordWithRecordId:(NSString *)recordId success:(void (^)(NSString *message))success failure:(HttpRequestFailure)failure;

/**
 *  违约列表
 */
+ (void)entryuiWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  违约图片
 */
+ (void)defaultPicsWithParams:(NSDictionary *)params success:(void (^)(CYDefaultRecordPics *defrs))success failure:(HttpRequestFailure)failure;
/**
 *  审核通过的网络收集违约人列表
 *
 *  @param param
 *  @param success
 *  @param failure
 */
+ (void)getNetworkCollectRecordsWithParam:(NSDictionary *)param success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure1)failure;
/**
 *  根据身份证号、姓名、号码等进行查询网络违约人信息
 */
+ (void)getNetworkCollectRecordsBySearchWithParam:(NSDictionary *)param success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure1)failure;
/**
 *  查询审核通过的违约记录数
 *
 *  @param success
 *  @param failure
 */
+ (void)getAuditNetworkCollectRecordNumSuccess:(void (^)(NSNumber *total))success failure:(HttpRequestFailure)failure;
/**
 *  根据id查询违约人详细信息
 *
 *  @param param
 *  @param success
 *  @param failure
 */
+ (void)getAuditNetworkCollectRecordsByIdWithParam:(NSDictionary *)param success:(void (^)(CYNetworkCollectRecord *record))success failure:(HttpRequestFailure1)failure;
/**
 *  保存申述信息
 */
+ (void)saveAllegeWithParams:(NSDictionary *)params success:(void (^)(NSString *message))success failure:(HttpRequestFailure2)failure;
/**
 *  添加网络收集违约人
 */
+ (void)addNetworkCollectRecordWithParams:(NSDictionary *)params success:(void (^)(NSString *message))success failure:(HttpRequestFailure2)failure;

#pragma mark -
/**
 *  将date转换为yyyy年MM月dd日格式的字符串时间
 *
 *  @param date
 *
 *  @return 时间
 */
+ (NSString *)timeWithDate:(NSDate *)date formatter:(NSString *)format;
/**
 *  将format格式的字符串转换为date
 *
 *  @param date
 *
 *  @return 时间
 */
+ (NSDate *)dateWithDateStr:(NSString *)dateStr formatter:(NSString *)format;

/**
 *  将服务器返回的date时间转为yyyy年MM月dd日格式的字符串时间
 *
 *  @param value JavaDate
 *
 *  @return 时间
 */
+ (NSString *)timewithLongLongValue:(long long)value formatter:(NSString *)formatter;

/**
 *  根据服务器返回的date时间计算天数差
 *
 *  @param value JavaDate
 *
 *  @return 天数
 */
+ (NSNumber *)dayWithStartValue:(NSNumber *)start endValue:(NSNumber *)end;

/**
 *  根据经纬度获取城市信息
 *
 *  @param param ak，callback，location，output=json，pois=1
 *  @param success
 *  @param failure
 */
+ (void)areaWithParam:(NSDictionary *)param success:(void (^)(NSDictionary *cityInfo))success failure:(HttpRequestFailure)failure;
/**
 *  根据身份证获取出生日期，年龄，性别
 */
+ (NSDictionary *)idCardInfo:(NSString *)idCard;
@end
